package legoproject.Behaviors;

import legoproject.*;
import legoproject.Behaviors.Behavior;
import java.util.ArrayList;

public class DropGarbage implements Behavior {

    private boolean left = true;
    private boolean right = true;

    public boolean condition() {
        left = GarbageCollector.leftTouchSensor.isPressed();
        right = GarbageCollector.rightTouchSensor.isPressed();
        boolean res = (!right || !left) && GarbageCollector.garbageInGrab && (GarbageCollector.lightSensor.readValue() < GarbageCollector.blackThreshold);
        boolean debug = GarbageCollector.leftButton.isPressed();
        return res || debug;
    }

    public ArrayList behave() {
        ArrayList result = new ArrayList();
        result.add(new Instruction(InstructionType.RELEASEGRAB, 0, 0));
        return result;
    }
}
